<script type="text/javascript"> 
 
    $(document).ready(function(){ 
		// initialise Superfish 
        $("ul.sf-menu").superfish({ 
            pathClass:  'Admins' 
        }); 
    }); 
 
</script>
	Users &nbsp;&nbsp;<a href="<?=APP_ROOT;?>/users/add">Add new</a><br />
	<br />
	<table cellpadding="2" cellspacing="3" class="list">
		<thead>
			<td class = "listID"><a href="<?=APP_ROOT;?>/users/index/orderBy:user.id<?php if(isset($orderBy) && !isset($DESC) && $orderBy == 'user.id') echo '/DESC:true';?>">ID</a></td>
			<td><a href="<?=APP_ROOT;?>/users/index/orderBy:user.name<?php if(isset($orderBy) && !isset($DESC) && $orderBy == 'user.name') echo '/DESC:true';?>">Name</a></td>
			<td><a href="<?=APP_ROOT;?>/users/index/orderBy:user.username<?php if(isset($orderBy) && !isset($DESC) && $orderBy == 'user.username') echo '/DESC:true';?>">Username</a></td>
			<td><a href="<?=APP_ROOT;?>/users/index/orderBy:group.name<?php if(isset($orderBy) && !isset($DESC) && $orderBy == 'group.name') echo '/DESC:true';?>">Group</a></td>
			<td class = "listAction">Action</td>
		</thead>
		<? 
			$i = 0;
			foreach ($users as $user){
				$i++;
				$id = $user['User']['id'];
				$name = $user['User']['name'];
				$username = $user['User']['username'];
				$group = $user['Group']['name'];
		?>
		<tr  class="<?php if($i%2) echo 'zuyg'; else echo 'kent';  ?>">
			<td class = "listID">
				<? echo $id; ?>
			</td>
			<td>
				<? echo $name; ?></td>
			<td>
				<?=$username;?>
			</td>
			<td>
				<?=$group;?>
			</td>
			<td class = "listAction">
				<a title="edit" href="<?=APP_ROOT;?>/users/edit/<?=$id?>" ><img src="<?=APP_ROOT;?>/img/icons/Colored/GIF/reply.gif" /></a>
				<a title="delete" onclick="javascript:del(<? echo $id; ?>)" href="#" ><img src="<?=APP_ROOT;?>/img/icons/Colored/GIF/action_delete.gif" /></a>
			</td>
		</tr>
		<?
		}//for main products
		?>
	</table>
<script language="javascript" type="text/javascript">
function del(id){
	if (confirm("Are you sure?")) {
    	window.location.href = "<?=APP_ROOT;?>/users/delete/"+id;
	}
}
</script>